<!--<?php
include_once PrintEot('header');
if(empty($action)){
print <<<EOT
-->
<form action="$admin_file" method="get" name="form">
<input type="hidden" name="job" value="$job"/>
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td align="left" class="tittab">
                <strong>站长管理 &gt;&gt; 站点广告位</strong>
            </td>
        </tr>
    </table>
    <table id="Table50" border="0" cellpadding="0" cellspacing="1" width="96%" align=center>
         <tr>
            <td colspan=2 height=30 class="zmenu"><b>数据分类：</b>
<!--
EOT;
 showPageLink("all", "1", "全部数据");
 showPageLink("audit", "0", "等待审核");
 showPageLink("audit", "1", "已审核");
 showPageLink("audit", "2", "审核未通过");
 showPageLink("status", "0", "空闲");
 showPageLink("status", "1", "可定向");
 showPageLink("status", "2", "已设定");
print <<<EOT
-->            
            </td></tr>
         <tr>
            <td><b>快速查询：</b><select id="searchtype" name="searchtype">
<!--
EOT;
	if(empty($searchtype) || $searchtype=="a.name")  echo '<option value="a.name" selected>广告位名称</option>';
    else echo '<option value="a.name">广告位名称</option>';
	if(empty($searchtype) || $searchtype=="a.keyword")  echo '<option value="a.keyword">关键字</option>';
    else echo '<option value="a.keyword">关键字</option>';
	if(empty($searchtype) || $searchtype=="a.demo_url")  echo '<option value="a.demo_url">示例网址</option>';
    else echo '<option value="a.demo_url">示例网址</option>'; 
	if(empty($searchtype) || $searchtype=="b.name")  echo '<option value="b.name">站点名称</option>';
    else echo '<option value="b.name">站点名称</option>';    
	if(empty($searchtype) || $searchtype=="b.url")  echo '<option value="b.url">网站地址</option>';
    else echo '<option value="b.url">网站地址</option>';
	if(empty($searchtype) || $searchtype=="a.adsize")  echo '<option value="a.adsize">广告位尺寸</option>';
    else echo '<option value="a.adsize">广告位尺寸</option>';     
print <<<EOT
-->				
							</select>
							<input type="text" name="searchkey" Width="60" style="font-size:12px;" class="text" value="$searchkey"/>
						开始时间：<input name="start_date" type="text"  class="text" readonly value="$start_date"/><A href="javascript:OpenCalendar('start_date', false)"><IMG src="$imgpath/admin/icon-calendar.gif" align="absMiddle" border="0"></A>
						结束时间：<input name="end_date" type="text" class="text" readonly value="$end_date"/><A href="javascript:OpenCalendar('end_date', false)"><IMG src="$imgpath/admin/icon-calendar.gif" align="absMiddle" border="0"></A>
						<input type="submit" value="查询" class="text"/>
						</td>
            <td align="right" valign="center">
                <table id="Table51" border="0" cellpadding="0" cellspacing="5" height="30">
                    <input id="Hidden1" name="allSelect" type="hidden" value="all" />
                    <tr>
                        <td align="middle" valign="center">
                            <a href="javascript:document.location.reload();">
                            <img align="absMiddle" border="0" height="15" src="$imgpath/admin/reserch.gif" style="text-decoration: underline" width="17" />
                            <span style="color: #547054"> 刷新</span></a>
<!--
EOT;
	if($canaudit==true){
		showButton(4,'审批','javascript:showAudit("'.$admin_file.'&action=audit&status=1'.$transtr.'&curpage='.$curpage.'");');
	}
	if($canadd==true){
		showButton(1,'新增',$admin_file.'&action=new'.$transtr);
	}
	if($candel==true){
		showButton(2,'删除','javascript:ConfirmDel("'.$admin_file.'&action=del'.$transtr.'&curpage='.$curpage.'","此操作不可恢复,确认删除吗？");');
	}
print <<<EOT
-->
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td height="2">
            </td>
        </tr>
    </table>
    <div class="tab">
        <table id="Table52" border="0" cellpadding="3" cellspacing="0" align=center>
            <tr>
                <td align="middle" class="title" height="20" valign="center">
                    序号</td>
                <td align="middle" class="title" height="20" valign="center">
                    <input id="Checkbox1" name="as" onclick="allchecked()" type="checkbox" />全选</td>
                <td align="middle" class="title" height="30" valign="center">站长-站点-广告位</td>
                <td align="middle" class="title" height="30" valign="center"> 示例网址</td>
                <td align="middle" class="title" height="30" valign="center">广告位尺寸</td>              
                <td align="middle" class="title" height="30" valign="center">CPC计价</td>    
                <td align="middle" class="title" height="30" valign="center">每周计价</td>    
               <td align="middle" class="title" height="30" valign="center">审核</td>            
               <td align="middle" class="title" height="30" valign="center">创建时间</td>                                              
                <td align="middle" class="title" height="30" valign="center">状态</td>                
                 <td align="middle" class="title" height="30" valign="center">编辑</td>
            </tr>
<!--
EOT;
$curidx = ($curpage-1)*$perpage;
$curpageidx = 0;
$showcount = count($db_affadplacelist); 
foreach($db_affadplacelist as $affadplace ){
	$curidx = $curidx+1;
	$curpageidx = $curpageidx+1;
	if($affadplace[create_time]>0) $cdate = date('Y/m/d H:i:s',$affadplace[create_time]);
	$db_placeaudit = $cfg_userstatus[$affadplace[audit]];
	$db_placestatus = $cfg_advplacestatus[$affadplace[status]];
print <<<EOT
-->    
            <tr height="30" onclick="SwitchTd(this,'click',$curpageidx);" onmouseout="SwitchTd(this,'out',$curpageidx);"
                onmouseover="SwitchTd(this,'over',$curpageidx);" style="cursor: hand">
                <td align="middle" valign="center">$curidx </td>
                <td align="middle" class="hei" valign="center"><input id="ids" name="ids" type="checkbox" value="$affadplace[id]" /></td>
                <td align="left" valign="center">&nbsp;<a href="$basename?job=detail&action=affiliate&curid=$affadplace[aff_id]$transtr&backurl=$backurl" class="NoLine">$affadplace[aff_name]($affadplace[aff_id])</a>-
                <a href="$basename?job=detail&action=affsite&curid=$affadplace[site_id]$transtr&backurl=$backurl" class="NoLine">$affadplace[site_name]($affadplace[site_id])</a> -$affadplace[name]               
				</td>
               <td valign="middle" align="center">&nbsp;<a href="$affadplace[demo_url]" title="$affadplace[demo_url]"><img src="$imgpath/admin/url.gif" border="0"/></a></td>                 
               <td valign="middle" align="center">&nbsp;$affadplace[adsize]</td>             
               <td valign="middle" align="center">&nbsp;$affadplace[week_price]</td>
               <td valign="middle" align="center">&nbsp;$affadplace[click_price]</td>
               <td valign="middle" align="center">&nbsp;$db_placeaudit</td> 
               <td valign="middle" align="center">&nbsp;$cdate</td>  
               <td valign="middle" align="center">&nbsp;$db_placestatus</td>                           
               <td valign="middle" align="center">&nbsp;
<!--
EOT;
	showEditButton($affadplace[id]);
print <<<EOT
-->
                </td>
            </tr>
<!--
EOT;
}print <<<EOT
-->            
        </table>
    </div>
    <table id="Table1" border="0" cellpadding="0" cellspacing="0" width="98%">
        <tr>
            <td>
                &nbsp;</td>
            <td align="right" height="35">
<!--
EOT;
	showPageBreakInfo($showcount);
print <<<EOT
-->
             &nbsp;</td>
        </tr>
    </table>
    <input type="hidden" id="count" name="count" value="$showcount" />

</form>

<!--
EOT;
}else if($action=="edit" || $action=="new"){
$clickprice = 0;
$weekprice = 0;
if($db_advplace){
	$clickprice = $db_advplace[click_price];
	$weekprice = $db_advplace[week_price];
}
print <<<EOT
-->
<form name="form" id="form" action="$admin_file" method="post" onsubmit="return checkfrm();">
<input type="hidden" name="action" value="save"/>
<input type="hidden" name="curid" value="$curid"/>
<input type="hidden" name="status" value="$status"/>
<input type="hidden" name="audit" value="$audit"/>
<input type="hidden" name="searchtype" value="$searchtype"/>
<input type="hidden" name="searchkey" value="$searchkey"/>
<input type="hidden" name="start_date" value="$start_date"/>
<input type="hidden" name="end_date" value="$end_date"/>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border=0 ID="Table22">
	<TBODY>
		<TR >
			<TD class="tittab" BACKGROUND="$imgpath/admin/menu_bg.gif">
			<strong><img src="$imgpath/admin/view.gif" width="15" height="13" align="absmiddle"> 新增/编辑　站点广告位</strong>
			</TD>
		</TR>
	</TBODY>
</TABLE>
<table cellspacing=0 cellpadding=0 width="100%" border=0 id="Table23">  
    <tbody>
      <tr>
        <td valign=top>
		<div class="addpro">
		<table cellspacing=0 cellpadding=4 width="100%" border=0 align=center id="Table24">
        <tbody>
              <tr><td></td><td colspan=3>请先点击“选择站长”，在弹出的窗口列表中，鼠标移动到列表行上背景颜色变化后，可点击选取一个站长，"所属站点"的下拉列表将自动列出该站长的所有已审核站点</td></tr>
                <tr>
					<td align=right width="25%">所属站长(<font color=red>*</font>)：</td>
					<td><input type="text" id="aff_name" name="aff_name" style="WIDTH: 261px"  value="$db_advplace[aff_name]" readonly/>
					<a href="javascript:void(0)" onclick="javascript:showAffSelHasSitelist();">
					    <IMG border="0" align="absmiddle" style="CURSOR: hand" height="21" src="$imgpath/admin/image_fdj.gif" width="24" align="absMiddle">选择站长
					</a><input type=hidden id="aff_id" name="aff_id" value="$db_advplace[aff_id]"/>
					</td>
				</tr>						
				<tr>
					<td align=right>所属站点(<font color=red>*</font>)：</td>
					<td align="left">
						<div id="divSite"><select name="site_id" id="site_id" style="WIDTH: 261px"><option value="">请选择...</option>$op_sitelist</select></div>
					</td>
				</tr>				
				<tr>
					<td align=right>广告位名称(<font color=red>*</font>)：</td>
					<td><input type="text" id="name" name="name" style="WIDTH: 132px"  value="$db_advplace[name]"/></td>
				</tr>		
				<tr>
					<td align=right>示例网址(<font color=red>*</font>)：</td>
					<td><input type="text" id="demo_url" name="demo_url" style="WIDTH: 325px"  value="$db_advplace[demo_url]"/></td>
				</tr>
                <tr>
					<td align=right>每周计价(<font color=red>*</font>)：</td>
					<td><input type="text" id="week_price" name="week_price" style="WIDTH: 50px" value="$weekprice" />元</td>
				</tr>
                <tr>
					<td align=right>点击计价(<font color=red>*</font>)：</td>
					<td><input type="text" id="click_price" name="click_price" style="WIDTH: 50px" value="$clickprice" />元</td>
				</tr>
				<tr>
					<td align=right>关 键 字：</td>
					<td><input type="text" id="keyword" name="keyword" style="WIDTH: 132px"  value="$db_advplace[keyword]"/></td>
				</tr>				
				<TR id=trClick1>
                <TD align=right>广告位尺寸：</TD>
                <TD><select id="adsize" name="adsize" style="WIDTH: 132px">
                <option value="">请选择...</option>
                $op_basesizelist
                	</select>
                </TD></TR>
              <TR>
				<tr>
					<td align=right style="height: 71px">描述：</td>
					<td style="height: 71px">
					    <textarea id="memo" name="memo" style="height:105px;Width:325px">$db_advplace[memo]</textarea>
					</td>
				</tr>											
				<tr>
					<td colspan="2" align="center">
					<input type="submit" id="btnSubmit" value=" 确定 " NAME="btnSubmit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
					<input type="button" onclick="history.go(-1);" value=" 取消 ">
					</td>
				</tr>
    </tbody>
 </table>
 </div></TD>
  </TR>
 </TBODY>

 </TABLE>
 </form>
<script type="text/javascript">
function checkfrm(){
	if(isEmpty($("aff_name").value)){
		alert('请选择站长！');
		$("aff_name").focus();
		return false;
	}
	if(isEmpty($('site_id').value)){
		alert('站点不能为空！');
		$('site_id').focus();
		return false;
	}
	if(isEmpty($('name').value)){
		alert('广告位名称不能为空！');
		$('name').focus();
		return false;
	}	
	if(isEmpty($('demo_url').value)){
		alert('示例网址不能为空！');
		$('demo_url').focus();
		return false;
	}
	if(isEmpty($('week_price').value)){
		alert('每周计价不能为空！');
		$('week_price').focus();
		return false;
	}else if(isNaN($('week_price').value)){
	    alert('每周计价必须为数字！');
	    $('week_price').focus();
		event.returnValue = false;
		return;
	}
	if(isEmpty($('click_price').value)){
		alert('点击计价不能为空！');
		$('click_price').focus();
		return false;
	}else if(isNaN($('click_price').value)){
	    alert('点击计价必须为数字！');
	    $('click_price').focus();
		event.returnValue = false;
		return;
	}
}
</script>
<!--
EOT;
}
if($action=="audit"){
print <<<EOT
-->
<form action="$admin_file" method="post" name="form" onsubmit="javascript:return checkfrm();">
<input type="hidden" name="action" value="auditsave"/>
<input type="hidden" name="ids" value="$ids"/>
<input type="hidden" name="status" value="$status"/>
<input type="hidden" name="audit" value="$audit"/>
<input type="hidden" name="searchtype" value="$searchtype"/>
<input type="hidden" name="searchkey" value="$searchkey"/>
<input type="hidden" name="start_date" value="$start_date"/>
<input type="hidden" name="end_date" value="$end_date"/>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border=0 ID="Table22">
	<TBODY>	    
		<TR >
			<TD class="tittab" BACKGROUND="$imgpath/admin/menu_bg.gif">
			<strong><img src="$imgpath/admin/view.gif" width="15" height="13" align="absmiddle"> 审批广告位</strong></TD>
		</TR>
	</TBODY>
</TABLE>
<table cellspacing=0 cellpadding=0 width="98%" border=0 id="Table23">  
    <tbody>
      <tr>
        <td valign=top>
		<div class="addpro">
		<table cellspacing=0 cellpadding=4 width="98%" border=0 align=center id="Table24">
            <tbody>
                <tr>
					<td align="right" width="15%">审批结果<font color=red>*</font>：</td>
					<td>
				 		<input type="radio" name="auditstatus" id='auditstatus1' value="1" checked onclick='javascript:$("content").value="广告位信息准确，允许通过！";'/><label for="auditstatus1">审核通过</label> 
				 		<input type="radio" name="auditstatus" id='auditstatus2' value="2" onclick='javascript:$("content").value="广告位信息不准确，不允许通过！";'/><label for="auditstatus2">审核不通过</label> 
					</td>
				</tr>
				<tr>
					<td align=right>审核内容：</td>
					<td><textarea name="content" id="content" style="width: 90%; height:55px">广告位信息准确，允许通过！</textarea></td>
				</tr>
				<tr>
					<td colspan="2" align="center">
					<input type="submit"  value=" 确定 " NAME="btnSubmit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
					<input type="button" onclick="window.close();" value=" 取消"/>
					</td>
				</tr>
         
    </tbody>
 </table>
 </div></TD>
  </TR>
 </TBODY>

 </TABLE>
 </form>
<script>
function checkfrm(){
	if(isEmpty($('content').value)){
		alert("请输入审批内容!");
	}
}
</script>

<!--
EOT;
}
if($action=="select"){
print <<<EOT
-->
<form name="form" action="$admin_file" method="post" onsubmit="return checkfrm();">

    <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td align="left" class="tittab">
                <strong>选择广告位</strong>
            </td>
        </tr>
    </table>
    <table id="Table50" border="0" cellpadding="0" cellspacing="1" width="98%" align=center>
         <tr>
         	<td>&nbsp;&nbsp;
			<b>快速查询：</b><select id="searchtype" name="searchtype">
			<!--
			EOT;
				if(empty($searchtype) || $searchtype=="a.name")  echo '<option value="a.name" selected>广告位名称</option>';
			    else echo '<option value="a.name">广告位名称</option>';
				if(empty($searchtype) || $searchtype=="a.keyword")  echo '<option value="a.keyword">关键字</option>';
			    else echo '<option value="a.keyword">关键字</option>';
				if(empty($searchtype) || $searchtype=="a.place_url")  echo '<option value="a.demo_url">示例网址</option>';
			    else echo '<option value="a.demo_url">示例网址</option>'; 
				if(empty($searchtype) || $searchtype=="b.name")  echo '<option value="b.name">站点名称</option>';
			    else echo '<option value="b.name">站点名称</option>';    
				if(empty($searchtype) || $searchtype=="b.url")  echo '<option value="b.url">网址地址</option>';
			    else echo '<option value="b.url">网址地址</option>';
				if(empty($searchtype) || $searchtype=="a.adsize")  echo '<option value="a.adsize">广告位尺寸</option>';
			    else echo '<option value="a.adsize">广告位尺寸</option>';     
			print <<<EOT
			-->				
				</select>
							<input type="text" name="searchkey" Width="60" style="font-size:12px;" class="text" value="$searchkey"/>     <input type="submit" value="查询" class="text"/>    	
         	</td>
            <td align="right" valign="center">
                <table id="Table51" border="0" cellpadding="0" cellspacing="5" height="30">
                    <input id="Hidden1" name="allSelect" type="hidden" value="all" />
                    <tr>
                        <td align="middle" valign="center">
                            <a href="javascript:document.location.reload();">
 <img align="absMiddle" border="0" height="15" src="$imgpath/admin/reserch.gif" style="text-decoration: underline" width="17" /><span style="color: #547054"> 刷新</span></a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td height="2">
            </td>
        </tr>
    </table>
    <div class="tab">
        <table id="Table52" border="0" cellpadding="3" cellspacing="0" align=center>
            <tr>
                <td align="middle" class="title" height="20" valign="center">序号</td>
                <td align="middle" class="title" height="20" valign="center">广告位</td>
                <td align="middle" class="title" height="20" valign="center">站点站长</td>                
                <td align="middle" class="title" height="20" valign="center">广告尺寸</td>
                <td align="middle" class="title" height="20" valign="center">周计价</td>          
                <td align="middle" class="title" height="20" valign="center">点击计价</td>  
                <td align="middle" class="title" height="20" valign="center">状态</td>                                      
            </tr>
<!--
EOT;
$curidx = ($curpage-1)*$perpage;
$curpageidx = 0;
$showcount = count($db_affadplacelist); 
foreach($db_affadplacelist as $affadplace ){
	$curidx = $curidx+1;
	$curpageidx = $curpageidx+1;	
	$db_placestatus = $cfg_advplacestatus[$affadplace[status]];
print <<<EOT
--> 
          <tr height="30" onclick="javascript:selAffAdPlace('$affadplace[id]','$affadplace[name]','$affadplace[aff_name]($affadplace[aff_id])-$affadplace[site_name]($affadplace[site_id])','$affadplace[aff_id]***$affadplace[site_id]')" onmouseout="SwitchTd(this,'out',$curpageidx);" onmouseover="SwitchTd(this,'over',$curpageidx);" style="cursor: hand">
                <td align="middle" valign="center">$curidx <input id="ids" name="ids" type="hidden" value="$affadplace[id]" /></td>
                <td align="middle" valign="center">&nbsp;$affadplace[name]</td>
                <td align="left" valign="center">&nbsp;<a href="$affadplace[demo_url]" target ="_blank" title="点击查看地址:$affadplace[demo_url]">$affadplace[aff_name]($affadplace[aff_id])-$affadplace[site_name]($affadplace[site_id])</a></td>    
               <td valign="middle" align="center">&nbsp;$affadplace[adsize]</td>             
               <td valign="middle" align="center">&nbsp;$affadplace[week_price]</td>
               <td valign="middle" align="center">&nbsp;$affadplace[click_price]</td>
               <td valign="middle" align="center">&nbsp;$db_placestatus</td>                           
            </tr>
<!--
EOT;
}
print <<<EOT
--> 
            
        </table>
    </div>
    <table id="Table1" border="0" cellpadding="0" cellspacing="0" width="98%">
        <tr>
            <td>&nbsp;</td>
            <td align="right" height="35">
<!--
EOT;
	showPageBreakInfo($showcount);
print <<<EOT
-->
             &nbsp;</td>
        </tr>
    </table>
    <input type="hidden" id="count" name="count" value="$showcount" />
</form>

<!--
EOT;
}
?>-->

